# -*- coding: utf-8 -*-

import random
import Action

class Specification:
  def __init__(self, name): self.name = name
  def changeAction(self, action): pass

class Agility(Specification):
  def __init__(self, value):
    Specification.__init__(self, "Agility")
    self.value = value

  def changeAction(self, action):
    if isinstance(action, Action.Intercept):
      action.success = random.randint(0, 100) < self.value

class Speed(Specification):
  def __init__(self, coefficient):
    Specification.__init__(self, "Speed")
    self.coefficient = coefficient

  def changeAction(self, action):
    if isinstance(action, Action.Move):
      action.coefficient *= self.coefficient